{{ $incidents := where .Site.RegularPages "Params.section" "issue" }}
{{ $active := where $incidents "Params.resolved" "=" false }}

{{ $isNotice := where $active "Params.severity" "=" "notice" }}
{{ $isDisrupted := where $active "Params.severity" "=" "disrupted" }}
{{ $isDown := where $active "Params.severity" "=" "down" }}

<!-- Define the number of posts per page -->
{{ $postsPerPage := .Site.Params.incidentPostsPerPage | default 10 }}

{{ if not $incidents }}
<div class="padding"></div>
<h3>{{ T "calmBeforeTheStorm" }}</h3>
<p>{{ T "noIncidentsDesc" }}</p>
<div class="padding"></div>
<div class="padding"></div>
<div class="padding"></div>
{{ else }}
<!-- Limit the displayed incidents to the configured number per page -->
{{ $limitedIncidents := first $postsPerPage $incidents }}

{{ range $limitedIncidents }}
{{ .Render "small" }}
{{ end }}

<!-- Check if there are more incidents than the posts per page -->
{{ if gt (len $incidents) $postsPerPage }}
<hr>
<div class="right">
	<a href="/issues/" class="next-link">
		{{ T "next" }} &nbsp; &rarr;
	</a>
</div>
{{ end }}
{{ end }}